/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package systole.view.abstractController;

import java.awt.event.KeyEvent;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.KeyStroke;

/**
 *
 * @author Juan Manuel
 */
public abstract class AbstractViewController {

    /**
     * close the form
     */
	public abstract void closeForm();

    protected void setCloseListener(JDialog form) {
        KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
        ViewCloseListener closeListener = new ViewCloseListener(this);
        form.getRootPane().registerKeyboardAction(closeListener, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);
    }
}
